home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 September / macformat-004.iso / Demos / Asymptote / Examples / Utility Scripts / powerlawfit < prev    next >
Encoding:
Text File  |  1994-06-15  |  403 b   |  19 lines  |  [TEXT/DWat]

  1. % powerlawfit  xmin xmax
  2.  
  3. % DESCRIPTION:
  4. % For log-log graphs. Fit y = a0 + a1*x for x in the given range.
  5.  
  6. % ARGUMENTS:
  7. %        xmin  = minimum x to include in fit
  8. %        xmax  = maximum x to include in fit
  9.  
  10. % •Note:This script modifies the e vector and replaces the y data
  11. %       with the calclated fit.
  12.  
  13. rpn <x &1 < <x &2 > + <x &1 >= <x &2 <= * 0.0001 * + >e
  14.  
  15. fitxy 1
  16.  
  17. rpn a0 <x a1 * + >y
  18.  
  19. close